﻿@using Eksponent.RazorRocks.Umbraco;
@{
    Layout = "~/masterpages/Master.cshtml";    
 }
<h1>Welcome to the frontpage</h1>

<div>This list uses the Wrap/Return value structure to get the class name for the li item</div>
<style>
    .default-item { color: Green; }
    .page-item { color: Blue;}
</style>
<ul>
@{int i = 0;}
@foreach( var node in RazorRocks.CurrentNode.Descendants().Items ) {
    //This is a little bit spicy. The "Wrap" method is used to add <li> tags around the templates' output.
    //If you look at the templates in the ReturnValueList folder you'll see that they use RazorRocks.ReturnValues to return a css class. This is used in the <li> tag. Voilà.
    @node.Render("ReturnValueList").Wrap(@<li class="@(i++ % 2 == 0 ? "even" : "odd") @item.ReturnValues.CssClass">@item.Output</li>)
}
</ul>


Fun with Razor delegates
@foreach (var node in RazorRocks.CurrentNode.Descendants().Items)
{
    @node.Render("RazorDelegates", new { Test = "A parameter value"})
}

<form method="post" action=""><input type="submit" value="Do postback" /></form>